import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FeedbackVO, FeedbackForm, FeedbackQuery } from '@/api/system/feedback/types';

/**
 * 查询问题反馈列表
 * @param query
 * @returns {*}
 */

export const listFeedback = (query?: FeedbackQuery): AxiosPromise<FeedbackVO[]> => {
  return request({
    url: '/system/feedback/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询问题反馈详细
 * @param problemFeedbackId
 */
export const getFeedback = (problemFeedbackId: string | number): AxiosPromise<FeedbackVO> => {
  return request({
    url: '/system/feedback/' + problemFeedbackId,
    method: 'get'
  });
};

/**
 * 新增问题反馈
 * @param data
 */
export const addFeedback = (data: FeedbackForm) => {
  return request({
    url: '/system/feedback',
    method: 'post',
    data: data
  });
};

/**
 * 修改问题反馈
 * @param data
 */
export const updateFeedback = (data: FeedbackForm) => {
  return request({
    url: '/system/feedback',
    method: 'put',
    data: data
  });
};

/**
 * 删除问题反馈
 * @param problemFeedbackId
 */
export const delFeedback = (problemFeedbackId: string | number | Array<string | number>) => {
  return request({
    url: '/system/feedback/' + problemFeedbackId,
    method: 'delete'
  });
};
